package com.urun.interceptor.hotanalysis.mapper.db1;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.urun.interceptor.hotanalysis.DTO.ClassifwordSearchDTO;
import com.urun.interceptor.hotanalysis.bean.Classifyword;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ClassifwordMapper extends BaseMapper<Classifyword> {

    @Select("select * from classifyword where SystemID=#{SystemID} and CompanyID=#{CompanyID}")
    public List<Classifyword> findWord(String SystemID, String CompanyID);

    @Insert("insert ignore into classifyword(word, `not`, typeid, name, systemid, companyid, definedsite, customerid,`Match`) values (#{Word},#{Not},#{TypeID},#{Name},#{SystemID},#{CompanyID},#{DefinedSite},#{CustomerID},#{Match});")
    boolean saveClassifyWord(Classifyword classifyword);

    @Select("select ID,Name,Word,TypeID,SystemID,CompanyID from classifyword where CompanyID=#{companyId} and SystemID=#{systemId}")
    List<ClassifwordSearchDTO> searchClassifWord(String systemId, String companyId);

    @Select(" select ID,Name,Word,TypeID from classifyword where id=#{id}")
    ClassifwordSearchDTO selectClassifyWordById(String id);

    @Update("update classifyword set Name=#{name},Word=#{word} where ID=#{id}")
    boolean EditClassifyword(ClassifwordSearchDTO searchDTO);

}
